/**
 * Created by gh on 2016/10/3.
 */
var Common={};
Common._live=function(){
    //placeholder兼容方案
    $('input, textarea').placeholder();
    /*多行文本，超出的显示省略号*/
    $(".multi-ellipsis").each(function(index,ele){
        var _row=$(ele).attr("data-row");
        $(ele).ellipsis({
            row:_row
        })
    });
    var mySwiper = new Swiper('.home-banner-swiper', {
        autoplay: 4000,
        loop:true,
        preloadImages:false,
        slidesPerView:1,
        calculateHeight : true,
        pagination : '.home-banner-pagination',
        paginationClickable :true,
        createPagination:true
    });
    $(".header-search-select").click(function (e) {
        e.stopPropagation();
        $(".header-search-type-list").slideDown(200);
    });
    $(".header-search-type-list").click(function (e) {
        e.stopPropagation();
    });
    $(".header-search-type-list li a").click(function () {
        var selectType=$(this).text();
        $(".header-search-select").text(selectType);
        $(".header-search-type-list").hide();
    })
    $(document).click(function () {
        $(".header-search-type-list").hide();
    });
    $(".back-top").click(function () {
        $("html,body").animate({
            "scrollTop":"0px"
        },"slow");
    });
    /*在建工地详情小图切换大图*/
    $(".csc-item-images .images-sm ul li").click(function () {
        $(this).parent().parent().parent(".csc-item-images").find(".image-lg").find("a")
            .find("img").attr("src",($(this).attr("data-csc-lg")));
    });
    $(".btn-close-budget-modal").click(function () {
        $(this).parent().parent(".modal").hide();
    });
    $(".budget-attach-open").click(function (e) {
        $(".budget-modal").fadeIn(300);
    });
    /*预约的提交*/
    $(".btn-attach_bar.order-house").click(function () {
        $(".appointment-modal").fadeIn(200);
    });
    $(".js-btn-cancel-appointment").click(function () {
        $(".appointment-modal").hide();
    });
    $(".js-btn-submit-appointment").click(function () {
        alert("提交成功");
        $(".appointment-modal").hide();
    });
}
$(function(){
    Common._live();
})